package com.t11;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * Created by xuyiwei on 2018/7/22.
 */
class Snow{}
class Powder extends Snow{}
class Light extends Powder{};
class Heavy extends Powder{};
class Crusty extends Snow{};
class Slush extends Snow{};
public class AsListInference {
    public static void main(String[] args) {
        List<Snow> list = new ArrayList<>();
        List<Snow> snow1 = Arrays.asList(new Crusty(),new Slush(),new Powder());
        List<Snow> snow2 = Arrays.asList(new Light(),new Heavy());
        //Exception in thread "main" java.lang.UnsupportedOperationException
//        snow1.addAll(snow2);
         List<Snow> snow4 = Arrays.<Snow>asList(new Light(),new Heavy());
//        Collections.addAll(list,snow4);
        snow4.addAll(snow2);
    }
}
